package com.fyyg.admin.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


import com.alibaba.dubbo.config.annotation.Reference;
import com.fyyg.interfaces.TSysUserService;
import com.fyyg.model.TSysUser;

@Controller
@RequestMapping("/index")
public class TbusiIndexController extends BaseController {
	
	final Logger logger = LogManager.getLogger(TbusiIndexController.class);
	
	
	@Reference private TSysUserService manageUserService;

    
	/**
	 * 后台模板页面
	 */
	@RequestMapping("/indexDemo")
	public String indexDemo() {
		return "home2";
	}

	

	/**
	 * 后台模板页面
	 */
	@RequestMapping("/indexwelcome")
	public String indexWelcome() {
		return "welcome";
	}
	
	
	
	
	/**
	 * 页面
	 * 
	 * @return
	 */
	@SuppressWarnings("finally")
	@RequestMapping("/indexpage")
	public String indexPage(HttpServletRequest request,HttpServletResponse response){
		String UID = (String)request.getSession().getAttribute("UID");
		try {
			TSysUser user = this.getCurrentUser(UID,request);
			if (user == null){
				return "redirect:/login/loginpage.jhtml";
			}else{
				return "home";
			}
		} catch (RuntimeException e) {
			e.printStackTrace();
        	logger.error("未知错误,请联系管理员：{}", e);
        }finally {
		}
		return "home";
	}
	

	

	
	

}
